package com.kedsoft.docms.service.impl;

import com.kedsoft.docms.entity.Param;
import com.kedsoft.docms.mapper.ParamMapper;
import com.kedsoft.docms.service.ParamService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.kedsoft.docms.vo.Pagination;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LGP
 * @since 2018-11-20
 */
@Service
public class ParamServiceImpl extends ServiceImpl<ParamMapper, Param> implements ParamService {
    public Pagination<Param> pageList(Pagination<Param> pagination, Map<String, Object> query) {
        query.put("offset", pagination.offset());
        query.put("limit", pagination.limit());
        query.put("sort", pagination.getSort());
        query.put("order", pagination.getOrder());
        pagination.setItems(baseMapper.list(query));
        pagination.setTotal(baseMapper.count(query));
        return pagination;
    }
}
